package com.example.nophase.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.example.nophase.R;
import com.example.nophase.entity.AdultItemDTO;

import java.util.List;

public class AdultListAdapter extends BaseAdapter {
    List<AdultItemDTO> dataList ;
    Context context;

    public AdultListAdapter(List<AdultItemDTO> dataList, Context context) {
        this.dataList = dataList;
        this.context = context;
    }

    public List<AdultItemDTO> getDataList() {
        return dataList;
    }

    public void setDataList(List<AdultItemDTO> dataList) {
        this.dataList = dataList;
    }

    @Override
    public int getCount() {
        return dataList.size();
    }

    @Override
    public Object getItem(int position) {
        return dataList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        View view = LayoutInflater.from(context).inflate(R.layout.layout_animation,null);
        TextView getTheme = view.findViewById(R.id.tweetName);
        TextView getCreateTime = view.findViewById(R.id.online);
        getTheme.setText(dataList.get(position).getTheme().toString());
        getCreateTime.setText(dataList.get(position).getCreateTime().toString());
        return view;
    }
}
